package rdd.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark01_RDD_Coalecse {
  def main(args: Array[String]): Unit = {
    val sparkConf: SparkConf = new SparkConf().setMaster("local[*]").setAppName("RDD")
    val sc = new SparkContext(sparkConf)
    //求相同时间段内的点击数量
    val rdd: RDD[Int] = sc.makeRDD(List(1, 2,3,4,5,6),2)
    val newRDD: RDD[Int] = rdd.coalesce(3,true)
    newRDD.saveAsTextFile("data/out")
    sc.stop()
  }

}
